import * as constants from './constants'

const defaultState = {
  inputValue: 'test',
  list: ['test']
}

export default (state = defaultState, action) => {
  let newState = JSON.parse(JSON.stringify(state))
  console.log(constants.ADD_ITEM, 11)
  switch (action.type) {
    case constants.CHANGE_INPUT_VALUE:
      newState.inputValue = action.value
      return newState
    case constants.ADD_ITEM:
      newState.list = [...newState.list, newState.inputValue]
      return newState
    default:
      return state
  }
}
